<template>
    <div>
        <i-upload :before-upload="handleUpload" action="">
            <i-button icon="ios-cloud-upload-outline">Upload files</i-button>
        </i-upload>
    </div>
</template>

<script>
const XLSX = require('xlsx');
export default {
    data () {
        return {}
    },
    methods: {
        async readFile (file) {
            let reader = new FileReader();
            reader.onload = e => {
                let data = new Uint8Array(e.target.result);
                let workbook = XLSX.read(data, {type: 'array'});
                console.log(workbook);
                /* DO SOMETHING WITH workbook HERE */
                for (let sheet in workbook) {
                    console.log(sheet);
                }
            };
            reader.readAsArrayBuffer(file);
        },
        handleUpload (file) {
            this.file = file;
            this.readFile(file);
            return false;
        }
    }
}
</script>

<style>

</style>
